$(function (){
    var memberHtml = '<a class="btn mr5" href="'+WapSiteUrl+'/tmpl/member/member.html?act=member">个人中心</a>';
    var act = GetQueryString("act");
    if(act && act == "member"){
        memberHtml = '<a class="btn mr5" id="logoutbtn" href="javascript:void(0);">注销账号</a>';
    }
    var tmpl = '';/*<div class="footer">'
        +'<div class="footer-top">'
            +'<div class="footer-tleft">'+ memberHtml +'</div>'
            +'<a href="javascript:void(0);"class="gotop">'
                +'<span class="gotop-icon"></span>'
                +'<p>回顶部</p>'
            +'</a>'
        +'</div>'
        +'<div class="footer-content">'
            +'<p class="link">'
                +'<a href="'+WapSiteUrl+'" class="standard">手机版首页</a>'
                +'<a href="'+AndroidSiteUrl+'">下载Android客户端</a>'
            +'</p>'
            +'<p class="copyright">'
                +'版权所有 2007-2014 © xxx.com'
            +'</p>'
        +'</div>'
    +'</div>'
	*/
	//
		    	+'<nav class="mui-bar mui-bar-tab">'
		    			+'<a href="'+WapSiteUrl+'/index.html" class="mui-tab-item1">'
		    				+'<span style="margin: -2px 0 2px 0;" class="mui-icon"><img style="width: 20px;" src="images/index_112.jpg"></span>'
		    				+'<span class="mui-tab-label">首页</span>'
		    			+'</a>'
		    			+'<a href="'+WapSiteUrl+'/tmpl/product_first_categroy.html" class="mui-tab-item1" id="tabbar-with-fenlei">'
		    				+'<span class="mui-icon "><img style="width: 20px;" src="images/index_115.jpg"></span>'
		    				+'<span class="mui-tab-label">分类</span>'
		    			+'</a>'
		    			+'<a href="'+WapSiteUrl+'/tmpl/cart_list.html" class="mui-tab-item1" id="tabbar-shoppingcart">'
		    				+'<span class="mui-icon "><img style="width: 20px;" src="images/gouwuche239.png"><span class="mui-badge" style="display: none;">9</span></span>'
		    				+'<span id="gouwuche" class="mui-tab-label">购物车</span>'
		    			+'</a>'
		    			+'<a href="'+WapSiteUrl+'/tmpl/member/member.html?act=member" class="mui-tab-item1" id="tabbar-me-contact">'
		    				+'<span style="margin: -2px 0 2px 0;" class="mui-icon"><img style="width: 20px;" src="images/1_055.png"></span>'
		    				+'<span class="mui-tab-label">我</span>'
		    			+'</a>'
		    	+'</nav>';//
	var render = template.compile(tmpl);
	var html = render();
	$("#footer").html(html);
    //回到顶部
    $(".gotop").click(function (){
        $(window).scrollTop(0);
    });
    var key = getcookie('key');
	$('#logoutbtn').click(function(){
		var username = getcookie('username');
		var key = getcookie('key');
		var client = 'wap';
		$.ajax({
			type:'get',
			url:ApiUrl+'/index.php?act=logout',
			data:{username:username,key:key,client:client},
			success:function(result){
				if(result){
					delCookie('username');
					delCookie('key');
					location.href = WapSiteUrl+'/tmpl/member/login.html';
				}
			}
		});
	});
});